Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update reading test auth model #1240

Merged
merged 5 commits into from
Jun 17, 2024
Merged

Conversation

kian99
Copy link
Contributor

@kian99 kian99 commented Jun 14, 2024

Description

The following change fixes an issue with test caching in JIMM. The current test code used to read the auth model would walk up the directory structure until finding a folder called "local", along the way it would read each directory. The issue with this is that the go test tool is smart enough to detect which files/directories are read by tests and invalidate the test cache when a potential input is changed. This meant that any change to a file, e.g. README.md would invalidate the test cache.

To resolve this, I've created .go file in the top level openfga folder/package where the authorisation_model.json file exists, embedded the file into the .go package and then referenced that package from the tests. This allows tests run from the root or any sub-directory to work.

Engineering checklist

Check only items that apply

  • Documentation updated
  • Covered by unit tests
  • Covered by integration tests

@kian99 kian99 requested a review from a team as a code owner June 14, 2024 13:21
Copy link
Member

@babakks babakks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this.

openfga/readme.md Outdated Show resolved Hide resolved
@kian99 kian99 force-pushed the update-read-auth-model branch from 2f31602 to c22b74a Compare June 14, 2024 14:42
Copy link
Collaborator

@alesstimec alesstimec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a comment

openfga/auth_model.go Show resolved Hide resolved
@kian99 kian99 merged commit c0d845a into canonical:v3 Jun 17, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants